CREATE TRIGGER trigger_Szallitok
 ON Szallitok
     
   instead of Delete
    AS  declare @v Int
     BEGIN  
    	
		
		declare t2 cursor for
			select  SzallitId from Szallit
			where ( select SzallitoId  from deleted) =  SzallitoId
			
		open t2
		fetch next from t2 into @v
		while @@fetch_status = 0
		begin
			Delete From Szallit 
			where SzallitID = @v
		
		fetch next from t2 into @v
			  end
			close t2
		deallocate t2		
		
		Delete From Szallitok
		where ( select SzallitoId  from deleted) =  SzallitoId
		
end